package com.wc.alorithm_blue_bridge._数学知识.快速幂.Q4761;

import java.util.Scanner;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/12/19-17:35
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        if (isSQ(num)) {
            System.out.println("Y");
        } else {
            System.out.println("N");
        }
    }

    static boolean isSQ(int num) {
        int sq = (int) Math.sqrt(num);
        int left = 1;
        int right = sq;
        while (left <= right) {
            int sum = left * left + right * right;
            if (sum == num) {
                return true;
            } else if (sum > num) {
                right--;
            } else {
                left++;
            }
        }

        return false;
    }
}
